package com.example.werthwedemo0309.IntentData;

import android.app.Application;

import retrofit2.Retrofit;
import retrofit2.adapter.rxjava.RxJavaCallAdapterFactory;
import retrofit2.converter.gson.GsonConverterFactory;

public class BaseApplication extends Application
{

    public static HttpbinService httpbinService;

    @Override
    public void onCreate()
    {
        super.onCreate();

        Retrofit retrofit =
                new Retrofit.Builder()
                        //URL主机地址
                        .baseUrl("http://apis.juhe.cn/simpleWeather/")
                        //添加解析插件
                        .addConverterFactory(GsonConverterFactory.create())
                        //添加RxJava请求框架
                        .addCallAdapterFactory(RxJavaCallAdapterFactory.create())
                        .build();

        createRequest(retrofit);
    }
    private void createRequest(Retrofit retrofit)
    {
        httpbinService = retrofit.create(HttpbinService.class);
    }
}
